using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        static string Username;

        static string Password;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Username = Request.QueryString["username"];
                Password = Request.QueryString["password"];
            }
        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (TextBox1.Text.Equals(Username) || Username != null)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }

        protected void LoadingHas_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (TextBox1.Text.Equals(Username) || Username != null)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }

        protected void PasswordCustom_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (TextBox2.Text.Equals(Password) || Password != null)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }

        protected void CustomValidator2_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (args.Value == "admin")
            {
                CustomValidator2.IsValid = true;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
            Response.Write(Username+","+Password);
            if (Page.IsValid == true)
            {
                Literal1.Text = "<a href=\"WebForm3.aspx\">登录成功</a>";
            }
        }
    }
}